﻿using MediatR;
using S.EarTag.API.Mediator.MediatorCommand.EarTagCommand;
using S.EarTag.Domain.Model;
using S.EarTag.Infrastructure.Repository.Interface.IEarTagRepository;
using System.Collections.Generic;

namespace S.EarTag.API.Mediator.MediatorCommandHandler.EarTagCommandHandler
{
    public class EarTagUpdDateStateCommandHandler : IRequestHandler<EarTagUpdDateStateCommand, bool>
    {
        private readonly IEarTagModelRepository _earTagModelRepository;
        public EarTagUpdDateStateCommandHandler(IEarTagModelRepository earTagModelRepository)
        {
            _earTagModelRepository= earTagModelRepository;
        }
        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public async Task<bool> Handle(EarTagUpdDateStateCommand request, CancellationToken cancellationToken)
        {
            return await _earTagModelRepository.UpdateEarTagState(request.EarTag);
        }
    }
}
